package com.aaa.behind.service.impl;

import com.aaa.behind.dao.OOrderMapper;
import com.aaa.behind.service.IOOrderService;
import com.aaa.entity.Bid;
import com.aaa.entity.OOrder;
import com.aaa.entity.Order;
import com.aaa.util.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单信息 服务实现类
 * </p>
 *
 * @author whj
 * @since 2023-01-05
 */
@Service
public class OOrderServiceImpl extends ServiceImpl<OOrderMapper, OOrder> implements IOOrderService {

    @Resource
    private OOrderMapper orderMapper;

    @Override
    public List<Order> findSname() {
        return orderMapper.findSname();
    }

    @Override
    public String findGname(String code) {
        return orderMapper.findGname(code);
    }

    @Override
    public boolean updState(String code, Integer state) {
        return orderMapper.updState(code, state);
    }

    @Override
    public IPage rotationSearch(PageInfo pageInfo, Bid bid) {
        if (bid.getBid() != null){
            return orderMapper.selectGname(pageInfo,bid);
        }
        return orderMapper.rotationSearch(pageInfo);
    }


}
